package fr.esiag.isidis.epp.launcher;


import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

import fr.esiag.isidis.epp.service.CDCAndWeightService;
import fr.esiag.isidis.epp.service.SiteService;
import fr.esiag.isidis.epp.service.TemperatureService;

/**
 * 
 * @author MEDINI
 * @author christian
 *
 */
public class EPPLauncher 
{
	private static Logger logger = Logger.getLogger(EPPLauncher.class);
	
    public static void main( String[] args )
    {
    	ApplicationContext context = new FileSystemXmlApplicationContext("classpath:/epp-context.xml");
        CDCAndWeightService cdcWeightService = context.getBean(CDCAndWeightService.class);
		SiteService site = context.getBean(SiteService.class);
		TemperatureService temp = context.getBean(TemperatureService.class);
        try 
		{
			
        	//site.loadCsvFile();
        	logger.debug("FIN DE L'INSERTION DU SITE et de ACTIVITY");
        	cdcWeightService.loadCsvFile();
			logger.debug("FIN DE L'INSERTION DE CDC et WEIGHT");
			temp.loadCsvFile();
			logger.debug("FIN DE L'INSERTION DE TEMPERATURE");	
			logger.debug("FIN DE L'INSERTION DES FICHIERS");
		} catch (Exception e) {
			e.printStackTrace();
			logger.error("INSERTION NON ACHEVEE");
		}
		
		
    }
}
